package com.bee.beemanage.system.configs.SecurityConfigs;

import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 设置放行的接口(经过测试发现没有必要设置放行，因为只要不设置权限就可以访问到接口，也就相当于放行了)
 */
@Component
public class PermitAllUrlProperties implements InitializingBean {

    @Getter
    @Setter
    private List<String> ignoreUrls = new ArrayList<>();

    @Override
    public void afterPropertiesSet(){
        // 放行 swagger 相关路径
        String[] authWhiteList = { "/swagger-ui.html",
                "/swagger-ui/*",
                "/swagger-resources/**",
                "/v2/api-docs",
                "/v3/api-docs",
                "/webjars/**",
                "/login",
                "/logout",
                "/bee-manage/verifyCode",
                "/bee-manage/wx/login"
        };
        ignoreUrls.addAll(Arrays.asList(authWhiteList));
    }
}
